package file;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:字节流的read(byte[] data)方法
 * User: 王圆豪
 * Date: 2025-05-10
 * Time: 17:36
 */
public class Demo9 {
    public static void main(String[] args) throws IOException {
        try (InputStream inputStream = new FileInputStream("./test.txt")){
            byte[] data = new byte[1024];
            int n = inputStream.read(data);
            for (int i = 0; i < n; i++) {
                System.out.printf("%x\n", data[i]);
            }
            System.out.println(n);
        }
    }
}
